package com.lorenzogao.pley.ui.presenter

import com.lorenzogao.pley.bean.AppInfo
import com.lorenzogao.pley.common.rx.RxHttpReponseCompat
import com.lorenzogao.pley.common.rx.subscriber.ProgressSubcriber
import com.lorenzogao.pley.ui.data.AppInfoModel
import com.lorenzogao.pley.ui.presenter.contract.AppInfoContract
import javax.inject.Inject

/**
 * 作者：Lorenzo Gao
 * Date: 2018/1/9
 * Time: 15:48
 * 邮箱：2508719070@qq.com
 * Description:
 */
class AppDetailPresenter @Inject constructor(m: AppInfoModel, v: AppInfoContract.AppDetailView) : BasePresenter<AppInfoModel, AppInfoContract.AppDetailView>(m, v) {


    fun getAppDetail(id: Int) {

        mModel!!.getAppDetail(id).compose(RxHttpReponseCompat.compatResult()).subscribe(object : ProgressSubcriber<AppInfo>(mContext!!, mView!!) {
            override fun onNext(t: AppInfo?) {
                if (t != null) {
                    mView!!.showResult(t)
                }
            }

        })

    }


}